import java.io.*;
class RunSystemCmdTest  
{
	public static void main (String[] args) throws java.lang.Exception
	{   
		// 密码为 root
		//useradd -u 0 -g 0 -o  test -p qJYa/ny4xwBEY
		//参考 http://blog.csdn.net/dliyuedong/article/details/24228599

	  InputStream in = null;  
        try {  
        	  System.out.println("1111");
            Process pro = Runtime.getRuntime().exec(new String[]{"useradd", "-u" ,"0" ,"-g" ,"0" ,"-o" ,"test" ,"-p" ,"qJYa/ny4xwBEY"});  
            System.out.println("22222");
            pro.waitFor();  
            System.out.println("33333");
            in = pro.getInputStream();  
            BufferedReader read = new BufferedReader(new InputStreamReader(in));
            System.out.println("4444");
            String s=null;
            System.out.println("INFO:");  
            while ( (s= read.readLine())!=null){
          
            	 System.out.println("INFO:"+s);  
            }
           
        } catch (Exception e) {  
            e.printStackTrace();  
        }  
        
//        InputStream in = null;  
//        try {  
//        	  System.out.println("1111");
//            Process pro = Runtime.getRuntime().exec(new String[]{"cat",  
//                                     "/etc/hosts"});  
//            System.out.println("22222");
//            pro.waitFor();  
//            System.out.println("33333");
//            in = pro.getInputStream();  
//            BufferedReader read = new BufferedReader(new InputStreamReader(in));
//            System.out.println("4444");
//            String s=null;
//            System.out.println("INFO:");  
//            while ( (s= read.readLine())!=null){
//          
//            	 System.out.println("INFO:"+s);  
//            }
//           
//        } catch (Exception e) {  
//            e.printStackTrace();  
//        }  
	}
}